﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

using LINQToolKit;
using LINQToolKit.Douban.Entities;
using LINQToolKit.Processors;
using LINQToolKit.Mapping;

namespace  LINQToolKit.Douban.Processors
{
    public sealed class TagsProcessor : PropertyProcessor
    {
        public override object FromXml(MetaProperty meta, IEnumerable<XElement> elements)
        {
            return
                (from e in elements
                 select new Tag
                 {
                     Name = e.Attribute("name").GetString(),
                     Count = e.Attribute("count").GetInt()
                 }).ToList();
        }
    }
}
